little refactoring
added comments
fixed another collinear bug