reworked to a programatic interface