slight refactor of everthing for nicer external api