initial obstacle impl.
code organization, and minor performance enhancements