Addressed Code review comments (test cases + formatting)
Did not do refactor to minimize queries yet.