Refactored code for Salamandar