Fixed attachment handling issue and added new features.