More refactor and add modal box