#88 partial fix

Working on algorithm (don't know whether whole algorithm will be implemented though)