Lab3: added return instructions based on type