improvements: - removed dead code, improved syntax