uncommented implementation
added comments