moving core functionality out into package