code cleanup, more optimizations..