Refactored solution to the lab issue and some bug fixes.

Change-Id: I597a39c519cc895043749f5bdbb7aea23080e6da
Signed-off-by: Anita Kanyange <ak.kanyange@gmail.com>