made imports more explicit, fixed some documentation and cleaned up the main function a bit