Functions almost completely implemented. Recursions still is not working.