Clean up code and unit tests, also provide better support for wrapping existing prototype based structures into classes