Entities updated.

Main entities routine mover to Entities class.
main.py cleaned up.