Made functions truly recursive...
made them truly recursive