cleaned up source. improved smoothness