Made functions int instead of void for cleanliness