added comments and javadoc, output of result/end position. corrected rotation crash.