Prevented errors and renamed some things + cleanup