Simplifying code and small adjusts