Entity stuff

Did not test, may be messed up.