modal plugin added and code refactor