replaced setTimeout with angular timeout function, minor bug fixes