modified to follow some best practices