Added phase calculation

Still with small error, but general functionality works
Deleted exec