code improvements (breaks some functionality tho)