cleaned up some stuff, works pretty well now

still need to comment more and tidy up the processBuffer function