General improvements, better organization and starting with tests