added flags and improved usability