Changed one liners into inline functions and added macro to delete copy-pasted code