Fixed a layer id assignment bug, renamed models to modules and implemented the overlap fix from issue #21