modal code duplication removed on into a single file