Moved the shape hierarchy to util, + some algorithmic fixes and... some
javadoc, as always