added ctrl+z support, encapsulated angle calculations