Initial implementation of cycle calculation and corresponding spec
Complete simple test cases. Streamline code