Added control line setup
Minor memory optimizations