removed unused code
corrected lag issue