Cleaned up first solution