Code cleanup as per @diegoreymendez's suggestions