Functional tests added
One fun test refactored
Small refactoring