updated profile function to take more options