added type hinting, improved templates