Code cleanup according to guidelines