fixed some bugs. reworked some stuff