Merged with my previous code