duplicating code for testing