Engineering The Properties of Magnetic Molecules Through The Interaction With The Surface