implement working solution
refactor format of solution