finalized except for validating code