overlay logic and templates