Reduce stack usage, this solves issue #22

Extract real real*8 functions to avoid code dupplication
and stack over usage