Created a platform filter and cleaned up code