initial structure
cleaner reimplementation