Almost have it working, need to iron out some bugs