Code cleanup

Some changes to existing code on Master for cleaning up code.