more fleshed out program architecure, mainly pseduocode