Updated marker detectio. Fixed some errors.