that took way too long, shouldn't have used enums :/