General refactors to improve screenshot service