Added better checks for entity, and getters/setters.