Added profiles + Logging + Code clean up