Refactor and working. Still need to clean it up a little more and add touch support