minor fixes (input validation still needs work + refactoring)