correction of bug + remove unused code