Refactored to use blocks instead of strings