added module validation, cleaned up