refactor code

At the moment the work modal does not work