fixed security problems and cleaned up a bit Closes #37