Added comments
Added javadoc commentary
Added comments and fixed the concurrency issue with layers adding other layers