dirty fix with global variables. Temporary to keep app code clean