made init script faster and smarter