updated based on changed proposed by enumag