code cleanup, added cache, readability improvements, init delay timer