moved code to external module