Maybe I should be using a framework for this