move window functions to a separated class