Fixed errors made by declaring functions wrong