Improved some part of the code