Code cleaned by removing unnecessary variables