Code cleaned by alex