pretified the code
my initial version of this