bug fix + more modular design + comment updates