Edited based on corrections from Mantha
Edited based on Ayvee's suggestions