cleaned up some code and fixed(ish) shift-click crash