New branch with correct formation
Cleaned up code