Code improvements

Small improvements to make code more readable and overall better.