reworked some things to hopefully make it run correctly