Added some base functionality. Still doesn't work though. Did some debugging and code is more sound though.