changed structure to be easily pluggable