moved init function to bottom - needs to have other functions declared before being called (d'oh).