Got everything working, with some input validation too