First draft

yep, i think this can be done in a more maintainable way