Added new embed_image function, fixed some logic errors, new constants added