Some really unpolished code :)