Another major refactor and remove unnecessary code

Signed-off-by: Harshavardhana <harsha@harshavardhana.net>