refactoring - module pattern used for appropriate methods encapsulation (e.g. "getMaxEntityIndex"); fixing entity drawing; when using select tool now the last drawn entity is selected