updated code for testing and template fixes