Passing all tests with a slight restructure