config support added + code cleanup