refactored coordinate system
added type signatures