Implemented k-d tree builder

also made Python type definitions much more concise and renamed "REAL" to "real"