Modified to remove unnecessary code