modal fixed and code cleaned up; closes #904; closes #938
refactored
Merge pull request #939 from affektive/availability

modal fixed and code cleaned up; closes #904; closes #938