Added a median noise removal algorithm